FRACTAL EDITOR : FrEd (ver. 1.3) (c)1993 by David Canright QUICK START: (F5 key to expand/contract help window, arrows up&down, PgUp/Dn) In FrEd, each FRACTAL is made of two or more pieces, and each PIECE is a smaller (and maybe distorted) copy of the whole fractal. The fractal RECIPE has a line of numbers for each piece that describes geometrically how to make the copy from the whole. FrEd has two screens: the main screen to edit recipes, open files, etc., and the graphics screen to display a fractal (dot by dot). To see a fractal, choose "Display" with the mouse or by Alt-D. HOW TO USE FrEd GRAPHICS SCREEN COMMANDS: (type capital letter) Random: generate a new fractal recipe from random numbers View all: adjust the screen view to fit the whole fractal Proportional: adjust screen view for correct x-y proportions Save image: save screen image to PCX file (specify filename, will add .PCX) restArt: clear the screen and start the dots again (this isn't on menu) type any OTHER key to return to the main screen EDITING FRACTAL RECIPES: (F6 to switch windows) Use the mouse (double-click) or Tab key to select a number (Shift-Tab to move back), then type a new number (also see Edit commands below). To check or uncheck a "flip" box, use the space bar or mouse. Note: IN A RECIPE, ALL NUMBERS MUST BE BETWEEN 0.0 AND 1.0 (except xoff and yoff, which can be anything). You may enter any digits, and the decimal point will be adjusted automatically (except xoff & yoff), so if you enter 5 you get 0.5 (but to get 0.1 or less you must include the decimal point). Negative numbers will be modified appropriately (see below). All angles ("angle", "rotatn") are in fractions of a full circle (so 0.25 is 90 degrees). The View boundaries may be any numbers; by default both x & y range from 0 to 1. MAIN SCREEN COMMANDS: (To access submenus, hit F10 and use arrow keys, or Alt key with highlighted letter, then type highlighted letter of command. Most commands are also directly accessible from the keyboard by Alt or Function keys (see below). To leave a menu or cancel a command, hit Esc key.) FILE submenu (Alt-F): Open (Alt-O): open a recipe file (.IFS extension) in new window New (Alt-N): open a new window with the default recipe (double dragon) Save (Alt-S): save current recipe to a file (.IFS extension) Change dir: change to another directory (for .IFS files; don't close help) Set BGI path: tell FrEd what directory has .BGI files (graphics drivers) Exit (Alt-X): bye-bye FrEd, back to DOS FRACTAL submenu (Alt-A): Display (Alt-D): show current fractal on graphics screen Set View (Alt-V): adjust view limits, either: to show fractal in correct x-y proportions, or to fit view to whole fractal (after displaying) # of Pieces (Alt-P): change number of pieces in recipe (up to 12) Design Piece (Alt-G): redefine numbers for current piece by where three points from the whole get copied to in the piece, or other info (see below) Calc Point (Alt-T): calculate where a point from the whole gets copied to in the current piece Random (Alt-R): generate random recipe Color pieces (Alt-C): switch between random color and color recipe Background B/W (Alt-B): switch between black and white background (EGA/VGA) EDIT submenu (Alt-E): Copy Piece (F7): copy whole line of numbers, to clipboard Paste Piece (F8): replace whole line of numbers, from clipboard Clear Piece (F9): clear whole line of numbers to 0 Copy Number (Shift-F7): copy number to clipboard Paste Number (Shift-F8): replace number from clipboard Clear Number (Shift-F9): clear number to 0 WINDOWS submenu (Alt-W): Move (Ctrl-F5): to move window using cursor arrows; hit Enter when done Next (F6): switch to next window Previous (Shift-F6): switch to previous window Close (Alt-F3): close current window other commands: (on bottom line; mouse works there too) Help (F1): open (or bring forward) help window with this information Menu (F10): move cursor to menu, use cursor arrows to move in menu WHAT IS A FRACTAL? In traditional geometry, shapes were simple and smooth, like circles and triangles, and could be described with a few numbers. But in nature, usually shapes are very complicated and rough, with lots of small details. And often, the details look similar to the whole thing, as a twig resembles a branch, which resembles a tree. So if you look closely at the details, you see details on the details, and even smaller details on the details on the details... Benoit Mandelbrot invented the name "fractal" for such geometric shapes, which have theoretically infinite levels of detail. (There is a mathematical way to redefine the idea of dimension so that fractals have fractional dimen- sion, so instead of a 1-D curve or a 2-D area it could be a 1.7-D fractal.) This computer program shows pictures of one of the simplest types of fractals, for which the whole shape is made up of two or more main pieces, where each piece is a shrunken (scaled) and moved copy of the whole thing. Thus each of the main pieces is made of smaller pieces, which are made of still smaller pieces... and so the shape has more and more details, the closer you look. (On the computer screen the image is limited by the screen resolution.) The picture is formed dot by dot, where each step takes the previous dot and copies it from the whole fractal to the corresponding point in one of the main pieces (remember, each piece is a smaller copy of the whole). Which piece to copy to is chosen at random each time. (Michael Barnsley developed this method; he calls it the "Chaos Game," as mentioned in the book "Chaos" by James Gleick. The detailed mathematics are given in "Fractals Everywhere," by Michael Barnsley. The recipe is called an Iterated Function System, or IFS.) At first, with only a few dots, the shape is indistinct, but the longer you wait, the clearer the details become. WHAT DO THE NUMBERS MEAN? The six numbers for each piece tell how the whole shape should be trans- formed (shrunken, rotated, and moved) to make that piece. The first three numbers tell how to shrink the copy: "scale1" and "scale2" give the relative shrinkage in two perpendicular directions, where "angle" gives the direction (as a fraction of 360 degrees) to which "scale1" applies. For example, if scale1=0.5, scale2=0.3, and angle=0.125, a circle would be transformed to an ellipse, with the long axis along a 45 degree diagonal direction, half as long as the diameter of the circle, and the short axis (in the perpendicular direction) 30% as long as the diameter of the circle. (This shows how, if scale1 and scale2 are different, the copy is distorted, and the angle shows in which direction it is distorted. But if both scales are the same, there is no distortion and the angle doesn't matter.) If the "flip" box is checked, the copy is flipped over to give a mirror image. (The direction given by "angle" is reversed, equivalent to making scale1 negative. Making scale2 negative is similar, with a 0.5 rotation.) The next number, "rotatn," tells how much to rotate the copy; for example, if rotatn=0.125, the ellipse above would be turned so that its long axis was vertical. (Rotation tends to give spiral shapes in the fractals.) The other two numbers tell how the copy should be positioned: "xf" and "yf" are the coordinates of the "focal point" (or "fixed point") of the transformation. The focal point is the one point that does not get moved by the transformation; that is, the copy of the focal point is in the same place as the original. So if the original circle above were centered at (0,0), and xf=0 and yf=0, the center of the transformed elipse would also be (0,0). The best way to understand all this is to start with a simple 2-piece recipe (like the default: the double-dragon fractal), and make each piece a different color (see below), then experiment. Be sure to set the View to proper proportions so no extra distortion is introduced. To keep things clear, don't let the pieces overlap; if they do, reduce the scales. Notice that changing one number in one piece can change the whole fractal. Beware that if all your pieces have the same focal point, the whole fractal is only that one point. COLOR RECIPES: When the color recipe option is chosen, there are two more numbers for each piece: "colscl" and "colorf", which are like the scale and focal point in the color dimension. So when the whole is copied to the piece, the range of colors is shrunk by colscl, and the color range is shifted toward colorf. If colscl is 0, the whole piece is the same color, given by colorf. If colscl is large (like 0.9), then the colors in the piece will be similar to the corre- sponding colors in the whole. Of course, the details of color are limited by the color resolution of the display (here, limited by the Borland BGI drivers). For EGA and VGA graphics, 15 colors are available, arranged somewhat like a rainbow, corre- sponding to the range of numbers from 0 to 1. (The full spectrum is shown in the Sierpinski triangle: TRIANGLE.IFS) The divisions between colors occur at 0.0667, 0.1333, 0.2000, etc. (multiples of 1/15). FRACTAL DESIGN: After some experience with FrEd, you may want to design a fractal with a particular shape. The trick is to figure out how to make that shape from smaller copies of itself. Try a very rough sketch on graph paper, then sketch a few smaller, squashed copies on top (maybe overlapping each other) so that the combined outline of the pieces approximates the shape you want. Now pick three representative points in the whole shape (not all in a line), and get their coordinates from the graph paper. For each smaller copy, estimate where those three points get copied to. Then you're ready for FrEd: (1) open a new fractal window (2) set the # of pieces (3) for each piece, select that line of the recipe (by selecting a number) (4) use the "Design Piece" command (from the Fractal menu): don't check the Undistorted Copy box or the Know Focal Point box; it will ask for a point in the whole and where it gets copied to (which you already wrote down) three times; after the third point all the numbers for that piece will be set (5) do steps 3-4 for all the other pieces. Instead of describing how three points get copied, you could base the design on other information. For example, if you know you want a piece to be an undistorted smaller copy of the whole, check the Undistorted Copy box. It will ask if you also know the scale (and if you want a flipped copy, check that box). If you do know the scale it will only need one point; if not it will need two. Also, if you know the focal point, check that box initially (and that counts as one of the points). For example, suppose you draw a right triangle with the corners on the points (0,0) (point A), (1,0) (B) and (0,1) (C) (draw a picture). And you realize that you can divide it in half into two smaller triangles, with a line from (0,0) to (0.5,0.5) (point D) (now open a new fractal window). For the lower triangle, you could choose to make the copy so that C from the whole goes to B in the copy, and B goes to A, and A goes to D (go ahead and put that information in). Then for the upper triangle, for variety, you could describe it as an undistorted copy that is flipped with C as a focal point, and again B from the whole goes to A in the copy (put that information in for the other line). Then display it; a proportional view should give the triangle. (Change one color scale to 0.8 to see the copies of copies; then the other. The lower copies spiral in but the upper copies zigzag toward the corner.) For more practice you might try designing your first initial as a fractal. Another tool you may find helpful is the "Calc Point" command. Pick a piece, and try the command: it will ask for a point from the whole (by default the last point it calculated), and calculate where the copy of that point is. PRINTING IMAGES: Be sure to run the DOS "GRAPHICS" command with appropriate arguments for your printer, BEFORE running FrEd. Then the PrintScreen key should work. To save an image to file, use the "Save image" command from the graphics screen (type "S", then give filename, no extension needed). This will save the whole screen (except the bottom text line) in a ZSoft Paintbrush format file (.PCX extension). Then the image can be used in other programs, such as paint programs or page layout applications. IMPORTANT NOTICE: FrEd was designed and developed by David Canright, using Borland C++ with the TurboVision library of objects. This software is distributed as FREEWARE, with no warrantees of any kind. The author retains all copyrights. You are licensed (and encouraged) to use the program as much as you want and to give copies to other people, provided the copies you distribute are IDENTICAL to the original, including ALL accessory files (preferably as the compressed package FREDEX.EXE and also READ.ME), and provided you charge no fees for the program. I would very much appreciate receiving a postcard with your comments, along with any cool recipes. David Canright 830 Altura Place Del Rey Oaks, CA 93940 (Compu-Serve: 71055,1403) HAVE FUN!